<?
    require_once("config.php");
    
    if ($_POST['action'] == 'new') {
        
        $projectname = $_POST['name'];
        if (!is_dir("projects/$projectname")) {
            mkdir("projects/$projectname");
            mkdir("projects/$projectname/frames");
            header("Location: project.php?action=work&project=$projectname");
        }
        else {
            header("Location: project.php?action=new&error=exists");
        }
    }
    
?>